﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using QuanLyBus.Model;
using testSMS;

namespace QuanLyBus
{
    public partial class App : Application
    {
        /// <summary>
        /// Provides easy access to the root frame of the Phone Application.
        /// </summary>
        /// <returns>The root frame of the Phone Application.</returns>
        public PhoneApplicationFrame RootFrame { get; private set; }
        public static string constr = @"Data Source=isostore:/QL_Tuyen.sdf";
        public static int id=-1;
        public static int id_t = -1;
        static public BangBam Godau = new BangBam();

        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions. 
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode, 
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
            using (QL_TuyenDataContext db = new QL_TuyenDataContext(constr))
            {
                int a = 1;
                if (!db.DatabaseExists())
                {
                    db.CreateDatabase();
                    // tuyen
                    db.ds_tuyens.InsertOnSubmit(new ds_tuyen() { id_tuyen = 1, ten_tuyen_den = "Bến Thành", ten_tuyen_di = "Chợ Lớn" });
                    db.ds_tuyens.InsertOnSubmit(new ds_tuyen() { id_tuyen = 2, ten_tuyen_den = "Bến Thành", ten_tuyen_di = "BX Miền Tây" });
                    // tram BT-CL
                    #region tram BT-CL
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 1, so_nha = "21", duong = "Tôn Đức Thắng", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 2, so_nha = "2-4", duong = "Nguyễn Huệ", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 3, so_nha = "8", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 4, so_nha = "10A", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 5, so_nha = "112", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 6, so_nha = "150", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 7, so_nha = "212", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 8, so_nha = "212", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 9, so_nha = "262", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 10, so_nha = "290", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 11, so_nha = "454", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 12, so_nha = "520", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 13, so_nha = "564", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 14, so_nha = "696", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 15, so_nha = "16", duong = "Trần Hưng Đạo B", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 16, so_nha = "128", duong = "Trần Hưng Đạo B", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 17, so_nha = "388", duong = "Trần Phú", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 18, so_nha = "214", duong = "Trần Hưng Đạo B", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 19, so_nha = "274", duong = "Trần Hưng Đạo B", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 20, so_nha = "346", duong = "Trần Hưng Đạo B", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 21, so_nha = "13", duong = "Châu Văn Liêm", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 22, so_nha = "210", duong = "Hải Thượng Lãn Ông", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 23, so_nha = "882", duong = "Trang Tử", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 24, so_nha = "đối diện số 14", duong = "Lê Quang Sung", quan = "6" });

                    for (int i = 1; i <= 24; i++)
                        db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 1, id_tram = i, thu_tu_tram_dung = i, tram_ve = 1 });
                    #endregion
                    //Tram CL-BT luot ve
                    #region CL-BT
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 25, so_nha = "27", duong = "Tháp Mười", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 26, so_nha = "327", duong = "Hải Thượng Lãn Ông", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 27, so_nha = "271", duong = "Hải Thượng Lãn Ông", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 28, so_nha = "155", duong = "Hải Thượng Lãn Ông", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 29, so_nha = "16", duong = "Châu Văn Liêm", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 30, so_nha = "68", duong = "Châu Văn Liêm", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 31, so_nha = "785", duong = "Nguyễn Trãi", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 32, so_nha = "695", duong = "Nguyễn Trãi", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 33, so_nha = "639", duong = "Nguyễn Trãi", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 34, so_nha = "635", duong = "Nguyễn Trãi", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 35, so_nha = "593", duong = "Nguyễn Trãi", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 36, so_nha = "549", duong = "Nguyễn Trãi", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 37, so_nha = "99", duong = "Nguyễn Tri Phương", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 38, so_nha = "388", duong = "Trần Phú", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 39, so_nha = "41", duong = "Trần Hưng Đạo B", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 40, so_nha = "1149", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 41, so_nha = "1031", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 42, so_nha = "981", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 43, so_nha = "929", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 44, so_nha = "813", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 45, so_nha = "671", duong = "Trần Hưng Đạo", quan = "5" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 46, so_nha = "567", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 47, so_nha = "449", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 48, so_nha = "357", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 49, so_nha = "301F", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 50, so_nha = "263", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 51, so_nha = "227", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 52, so_nha = "135", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 53, so_nha = "71", duong = "Trần Hưng Đạo", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 54, so_nha = "Trạm Điều Hành SG", duong = "Quách Thị Trang", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 55, so_nha = "33", duong = "Lê Lợi", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 56, so_nha = "125", duong = "Nguyễn Huệ", quan = "1" });
                    for (int j = 25; j <= 56; j++)
                    {
                        db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 1, id_tram = j, thu_tu_tram_dung = j, tram_ve = 0 });
                        a++;
                    }
                    #endregion

                    #region so 2
                    #region so 2 luot di
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 57, so_nha = "70C", duong = "Nguyễn Huệ", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 58, so_nha = "46", duong = "Lê Lợi", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 59, so_nha = "70C", duong = "Nguyễn Huệ", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 60, so_nha = "40", duong = "Phạm Hồng Thái", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 61, so_nha = "136", duong = "Nguyễn Trãi", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 62, so_nha = "224", duong = "Cống Quỳnh", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 63, so_nha = "488", duong = "Nguyễn Thị Minh Khai", quan = "3" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 64, so_nha = "80-82", duong = "Nguyễn Thiện Thuật", quan = "3" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 65, so_nha = "104Bis", duong = "3 Tháng 2", quan = "10" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 66, so_nha = "213", duong = "Minh Phụng", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 67, so_nha = "910", duong = "Hậu Giang", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 68, so_nha = "340", duong = "Kinh Dương Vương", quan = "6" });
                    #endregion
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 69, so_nha = "49", duong = "Kinh Dương Vương", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 70, so_nha = "292", duong = "Hậu Giang", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 71, so_nha = "242", duong = "Minh Phụng", quan = "6" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 72, so_nha = "1559", duong = "3 Tháng 2", quan = "11" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 73, so_nha = "75", duong = "Cao Thắng", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 74, so_nha = "210", duong = "Lê Lai", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 75, so_nha = "1A", duong = "Phạm Hồng Thái", quan = "1" });
                    db.ds_trams.InsertOnSubmit(new ds_tram() { id_tram = 76, so_nha = "33A", duong = "Lê Lợi", quan = "1" });


                    #region luot di
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 1, thu_tu_tram_dung = 1, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 2, thu_tu_tram_dung = 2, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 57, thu_tu_tram_dung = 3, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 58, thu_tu_tram_dung = 4, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 54, thu_tu_tram_dung = 5, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 60, thu_tu_tram_dung = 6, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 61, thu_tu_tram_dung = 7, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 62, thu_tu_tram_dung = 8, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 63, thu_tu_tram_dung = 8, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 64, thu_tu_tram_dung = 8, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 65, thu_tu_tram_dung = 8, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 66, thu_tu_tram_dung = 8, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 67, thu_tu_tram_dung = 8, tram_ve = 1 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 68, thu_tu_tram_dung = 8, tram_ve = 1 });
                    #endregion
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 69, thu_tu_tram_dung = 1, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 70, thu_tu_tram_dung = 2, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 71, thu_tu_tram_dung = 3, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 72, thu_tu_tram_dung = 4, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 73, thu_tu_tram_dung = 5, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 74, thu_tu_tram_dung = 6, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 75, thu_tu_tram_dung = 7, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 76, thu_tu_tram_dung = 8, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 54, thu_tu_tram_dung = 9, tram_ve = 0 });
                    db.tram_thuoc_tuyens.InsertOnSubmit(new tram_thuoc_tuyen() { id_tuyen = 2, id_tram = 56, thu_tu_tram_dung = 10, tram_ve = 0 });

                    #endregion

                    db.SubmitChanges();

                }
            }
            #region Tao CSDL
            #region
            Godau.Them('a', 'w', "ă");
            Godau.Them('a', 'a', "â");

            Godau.Them('a', 's', "á");
            Godau.Them('a', 'f', "à");
            Godau.Them('a', 'r', "ả");
            Godau.Them('a', 'x', "ã");
            Godau.Them('a', 'j', "ạ");

            Godau.Them('ă', 's', "ắ");
            Godau.Them('ă', 'f', "ằ");
            Godau.Them('ă', 'r', "ẳ");
            Godau.Them('ă', 'x', "ẵ");
            Godau.Them('ă', 'j', "ặ");

            Godau.Them('â', 's', "ấ");
            Godau.Them('â', 'f', "ầ");
            Godau.Them('â', 'r', "ẩ");
            Godau.Them('â', 'x', "ẫ");
            Godau.Them('â', 'j', "ậ");

            Godau.Them('d', 'd', "đ");

            Godau.Them('e', 'e', "ê");

            Godau.Them('e', 's', "é");
            Godau.Them('e', 'f', "è");
            Godau.Them('e', 'r', "ẻ");
            Godau.Them('e', 'x', "ẽ");
            Godau.Them('e', 'j', "ẹ");

            Godau.Them('ê', 's', "ế");
            Godau.Them('ê', 'f', "ề");
            Godau.Them('ê', 'r', "ể");
            Godau.Them('ê', 'x', "ễ");
            Godau.Them('ê', 'j', "ệ");

            Godau.Them('o', 'o', "ô");
            Godau.Them('o', 'w', "ơ");

            Godau.Them('o', 's', "ó");
            Godau.Them('o', 'f', "ò");
            Godau.Them('o', 'r', "ỏ");
            Godau.Them('o', 'x', "õ");
            Godau.Them('o', 'j', "ọ");

            Godau.Them('ô', 's', "ố");
            Godau.Them('ô', 'f', "ồ");
            Godau.Them('ô', 'r', "ổ");
            Godau.Them('ô', 'x', "ỗ");
            Godau.Them('ô', 'j', "ộ");

            Godau.Them('ơ', 's', "ớ");
            Godau.Them('ơ', 'f', "ờ");
            Godau.Them('ơ', 'r', "ở");
            Godau.Them('ơ', 'x', "ỡ");
            Godau.Them('ơ', 'j', "ợ");

            Godau.Them('u', 'w', "ư");

            Godau.Them('u', 's', "ú");
            Godau.Them('u', 'f', "ù");
            Godau.Them('u', 'r', "ủ");
            Godau.Them('u', 'x', "ũ");
            Godau.Them('u', 'j', "ụ");

            Godau.Them('ư', 's', "ứ");
            Godau.Them('ư', 'f', "ừ");
            Godau.Them('ư', 'r', "ử");
            Godau.Them('ư', 'x', "ữ");
            Godau.Them('ư', 'j', "ự");

            Godau.Them('i', 's', "í");
            Godau.Them('i', 'f', "ì");
            Godau.Them('i', 'r', "ỉ");
            Godau.Them('i', 'x', "ĩ");
            Godau.Them('i', 'j', "ị");

            Godau.Them('y', 's', "ý");
            Godau.Them('y', 'f', "ỳ");
            Godau.Them('y', 'r', "ỷ");
            Godau.Them('y', 'x', "ỹ");
            Godau.Them('y', 'j', "ỵ");
            #endregion
            //--------------------------------------
            #region
            Godau.Them('a', 'W', "ă");
            Godau.Them('a', 'A', "â");

            Godau.Them('a', 'S', "á");
            Godau.Them('a', 'F', "à");
            Godau.Them('a', 'R', "ả");
            Godau.Them('a', 'X', "ã");
            Godau.Them('a', 'J', "ạ");

            Godau.Them('ă', 'S', "ắ");
            Godau.Them('ă', 'F', "ằ");
            Godau.Them('ă', 'R', "ẳ");
            Godau.Them('ă', 'X', "ẵ");
            Godau.Them('ă', 'J', "ặ");

            Godau.Them('â', 'S', "ấ");
            Godau.Them('â', 'F', "ầ");
            Godau.Them('â', 'R', "ẩ");
            Godau.Them('â', 'X', "ẫ");
            Godau.Them('â', 'J', "ậ");

            Godau.Them('d', 'D', "đ");

            Godau.Them('e', 'E', "ê");

            Godau.Them('e', 'S', "é");
            Godau.Them('e', 'F', "è");
            Godau.Them('e', 'R', "ẻ");
            Godau.Them('e', 'X', "ẽ");
            Godau.Them('e', 'J', "ẹ");

            Godau.Them('ê', 'S', "ế");
            Godau.Them('ê', 'F', "ề");
            Godau.Them('ê', 'R', "ể");
            Godau.Them('ê', 'X', "ễ");
            Godau.Them('ê', 'J', "ệ");

            Godau.Them('o', 'O', "ô");
            Godau.Them('o', 'W', "ơ");

            Godau.Them('o', 'S', "ó");
            Godau.Them('o', 'F', "ò");
            Godau.Them('o', 'R', "ỏ");
            Godau.Them('o', 'X', "õ");
            Godau.Them('o', 'J', "ọ");

            Godau.Them('ô', 'S', "ố");
            Godau.Them('ô', 'F', "ồ");
            Godau.Them('ô', 'R', "ổ");
            Godau.Them('ô', 'X', "ỗ");
            Godau.Them('ô', 'J', "ộ");

            Godau.Them('ơ', 'S', "ớ");
            Godau.Them('ơ', 'F', "ờ");
            Godau.Them('ơ', 'R', "ở");
            Godau.Them('ơ', 'X', "ỡ");
            Godau.Them('ơ', 'J', "ợ");

            Godau.Them('u', 'W', "ư");

            Godau.Them('u', 'S', "ú");
            Godau.Them('u', 'F', "ù");
            Godau.Them('u', 'R', "ủ");
            Godau.Them('u', 'X', "ũ");
            Godau.Them('u', 'J', "ụ");

            Godau.Them('ư', 'S', "ứ");
            Godau.Them('ư', 'F', "ừ");
            Godau.Them('ư', 'R', "ử");
            Godau.Them('ư', 'X', "ữ");
            Godau.Them('ư', 'J', "ự");

            Godau.Them('i', 'S', "í");
            Godau.Them('i', 'F', "ì");
            Godau.Them('i', 'R', "ỉ");
            Godau.Them('i', 'X', "ĩ");
            Godau.Them('i', 'J', "ị");

            Godau.Them('y', 'S', "ý");
            Godau.Them('y', 'F', "ỳ");
            Godau.Them('y', 'R', "ỷ");
            Godau.Them('y', 'X', "ỹ");
            Godau.Them('y', 'J', "ỵ");
            #endregion

            //-------------------------------------------
            #region
            Godau.Them('A', 'w', "Ă");
            Godau.Them('A', 'a', "Â");

            Godau.Them('A', 's', "Á");
            Godau.Them('A', 'f', "À");
            Godau.Them('A', 'r', "Ả");
            Godau.Them('A', 'x', "Ã");
            Godau.Them('A', 'j', "Ạ");

            Godau.Them('Ă', 's', "Ắ");
            Godau.Them('Ă', 'f', "Ằ");
            Godau.Them('Ă', 'r', "Ẳ");
            Godau.Them('Ă', 'x', "Ẵ");
            Godau.Them('Ă', 'j', "Ặ");

            Godau.Them('Â', 's', "Ấ");
            Godau.Them('Â', 'f', "Ầ");
            Godau.Them('Â', 'r', "Ẩ");
            Godau.Them('Â', 'x', "Ẫ");
            Godau.Them('Â', 'j', "Ậ");

            Godau.Them('D', 'd', "Đ");

            Godau.Them('E', 'e', "Ê");

            Godau.Them('E', 's', "É");
            Godau.Them('E', 'f', "È");
            Godau.Them('E', 'r', "Ẻ");
            Godau.Them('E', 'x', "Ẽ");
            Godau.Them('E', 'j', "Ẹ");

            Godau.Them('Ê', 's', "Ế");
            Godau.Them('Ê', 'f', "Ề");
            Godau.Them('Ê', 'r', "Ể");
            Godau.Them('Ê', 'x', "Ễ");
            Godau.Them('Ê', 'j', "Ệ");

            Godau.Them('O', 'o', "Ô");
            Godau.Them('O', 'w', "Ơ");

            Godau.Them('O', 's', "Ó");
            Godau.Them('O', 'f', "Ò");
            Godau.Them('O', 'r', "Ỏ");
            Godau.Them('O', 'x', "Õ");
            Godau.Them('O', 'j', "Ọ");

            Godau.Them('Ô', 's', "Ố");
            Godau.Them('Ô', 'f', "Ồ");
            Godau.Them('Ô', 'r', "Ổ");
            Godau.Them('Ô', 'x', "Ỗ");
            Godau.Them('Ô', 'j', "Ộ");

            Godau.Them('Ơ', 's', "Ớ");
            Godau.Them('Ơ', 'f', "Ờ");
            Godau.Them('Ơ', 'r', "Ở");
            Godau.Them('Ơ', 'x', "Ỡ");
            Godau.Them('Ơ', 'j', "Ợ");

            Godau.Them('U', 'w', "Ư");

            Godau.Them('U', 's', "Ú");
            Godau.Them('U', 'f', "Ù");
            Godau.Them('U', 'r', "Ủ");
            Godau.Them('U', 'x', "Ũ");
            Godau.Them('U', 'j', "Ụ");

            Godau.Them('Ư', 's', "Ứ");
            Godau.Them('Ư', 'f', "Ừ");
            Godau.Them('Ư', 'r', "Ử");
            Godau.Them('Ư', 'x', "Ữ");
            Godau.Them('Ư', 'j', "Ự");

            Godau.Them('I', 's', "Í");
            Godau.Them('I', 'f', "Ì");
            Godau.Them('I', 'r', "Ỉ");
            Godau.Them('I', 'x', "Ĩ");
            Godau.Them('I', 'j', "Ị");

            Godau.Them('Y', 's', "Ý");
            Godau.Them('Y', 'f', "Ỳ");
            Godau.Them('Y', 'r', "Ỷ");
            Godau.Them('Y', 'x', "Ỹ");
            Godau.Them('Y', 'j', "Ỵ");
            #endregion
            //---------------------------------
            #region
            Godau.Them('A', 'W', "Ă");
            Godau.Them('A', 'A', "Â");

            Godau.Them('A', 'S', "Á");
            Godau.Them('A', 'F', "À");
            Godau.Them('A', 'R', "Ả");
            Godau.Them('A', 'X', "Ã");
            Godau.Them('A', 'J', "Ạ");

            Godau.Them('Ă', 'S', "Ắ");
            Godau.Them('Ă', 'F', "Ằ");
            Godau.Them('Ă', 'R', "Ẳ");
            Godau.Them('Ă', 'X', "Ẵ");
            Godau.Them('Ă', 'J', "Ặ");

            Godau.Them('Â', 'S', "Ấ");
            Godau.Them('Â', 'F', "Ầ");
            Godau.Them('Â', 'R', "Ẩ");
            Godau.Them('Â', 'X', "Ẫ");
            Godau.Them('Â', 'J', "Ậ");

            Godau.Them('D', 'D', "Đ");

            Godau.Them('E', 'E', "Ê");

            Godau.Them('E', 'S', "É");
            Godau.Them('E', 'F', "È");
            Godau.Them('E', 'R', "Ẻ");
            Godau.Them('E', 'X', "Ẽ");
            Godau.Them('E', 'J', "Ẹ");

            Godau.Them('Ê', 'S', "Ế");
            Godau.Them('Ê', 'F', "Ề");
            Godau.Them('Ê', 'R', "Ể");
            Godau.Them('Ê', 'X', "Ễ");
            Godau.Them('Ê', 'J', "Ệ");

            Godau.Them('O', 'O', "Ô");
            Godau.Them('O', 'W', "Ơ");

            Godau.Them('O', 'S', "Ó");
            Godau.Them('O', 'F', "Ò");
            Godau.Them('O', 'R', "Ỏ");
            Godau.Them('O', 'X', "Õ");
            Godau.Them('O', 'J', "Ọ");

            Godau.Them('Ô', 'S', "Ố");
            Godau.Them('Ô', 'F', "Ồ");
            Godau.Them('Ô', 'R', "Ổ");
            Godau.Them('Ô', 'X', "Ỗ");
            Godau.Them('Ô', 'J', "Ộ");

            Godau.Them('Ơ', 'S', "Ớ");
            Godau.Them('Ơ', 'F', "Ờ");
            Godau.Them('Ơ', 'R', "Ở");
            Godau.Them('Ơ', 'X', "Ỡ");
            Godau.Them('Ơ', 'J', "Ợ");

            Godau.Them('U', 'W', "Ư");

            Godau.Them('U', 'S', "Ú");
            Godau.Them('U', 'F', "Ù");
            Godau.Them('U', 'R', "Ủ");
            Godau.Them('U', 'X', "Ũ");
            Godau.Them('U', 'J', "Ụ");

            Godau.Them('Ư', 'S', "Ứ");
            Godau.Them('Ư', 'F', "Ừ");
            Godau.Them('Ư', 'R', "Ử");
            Godau.Them('Ư', 'X', "Ữ");
            Godau.Them('Ư', 'J', "Ự");

            Godau.Them('I', 'S', "Í");
            Godau.Them('I', 'F', "Ì");
            Godau.Them('I', 'R', "Ỉ");
            Godau.Them('I', 'X', "Ĩ");
            Godau.Them('I', 'J', "Ị");

            Godau.Them('Y', 'S', "Ý");
            Godau.Them('Y', 'F', "Ỳ");
            Godau.Them('Y', 'R', "Ỷ");
            Godau.Them('Y', 'X', "Ỹ");
            Godau.Them('Y', 'J', "Ỵ");
            #endregion
            #endregion


        }

        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
        }

        // Code to execute when the application is activated (brought to foreground)
        // This code will not execute when the application is first launched
        private void Application_Activated(object sender, ActivatedEventArgs e)
        {
        }

        // Code to execute when the application is deactivated (sent to background)
        // This code will not execute when the application is closing
        private void Application_Deactivated(object sender, DeactivatedEventArgs e)
        {
        }

        // Code to execute when the application is closing (eg, user hit Back)
        // This code will not execute when the application is deactivated
        private void Application_Closing(object sender, ClosingEventArgs e)
        {
        }

        // Code to execute if a navigation fails
        private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // A navigation has failed; break into the debugger
                System.Diagnostics.Debugger.Break();
            }
        }

        // Code to execute on Unhandled Exceptions
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // An unhandled exception has occurred; break into the debugger
                System.Diagnostics.Debugger.Break();
            }
        }

        #region Phone application initialization

        // Avoid double-initialization
        private bool phoneApplicationInitialized = false;

        // Do not add any additional code to this method
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            // Create the frame but don't set it as RootVisual yet; this allows the splash
            // screen to remain active until the application is ready to render.
            RootFrame = new PhoneApplicationFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handle navigation failures
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            // Ensure we don't initialize again
            phoneApplicationInitialized = true;
        }

        // Do not add any additional code to this method
        private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
        {
            // Set the root visual to allow the application to render
            if (RootVisual != RootFrame)
                RootVisual = RootFrame;

            // Remove this handler since it is no longer needed
            RootFrame.Navigated -= CompleteInitializePhoneApplication;
        }

        #endregion
    }
}